<style lang="scss" scoped>
.card_item {
  flex: 1;
  margin-right: 20px;
  border-radius: 4px;
  background: #0073b7;
  cursor: pointer;
  &:last-child {
    margin-right: 0;
  }
  .card_title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #fff;
    font-size: 12px;
    color: #fff;
    .tag {
      background: #3f7685;
      font-size: 12px;
      padding: 2px 4px;
      border-radius: 2px;
    }
  }
  .card_bottom {
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding: 40px 0;
  }
}
</style>

<template>
  <div class="card_item" :style="bacStyle">
    <div class="card_title">
      <span>{{ title }}</span>
      <div :style="tagBacStyle" class="tag" v-if="hasTag">{{ tagName }}</div>
    </div>
    <div class="card_bottom">¥ {{ showNumber }}</div>
  </div>
</template>

<script setup>
import { computed } from 'vue'
const props = defineProps({
  title: {
    type: String,
    default: ''
  },
  tagName: {
    type: String,
    default: '包含今日'
  },
  hasTag: {
    type: Boolean,
    default: false
  },
  showNum: {
    type: Number,
    default: 1200
  },
  bacColor: {
    type: String,
    default: '#0f89ab'
  },
  tagColor: {
    type: String,
    default: '#0f89ab'
  }
})

const showNumber = computed(() => {
  return (props.showNum || 0).toFixed(2)
})
const bacStyle = computed(() => {
  return {
    background: props.bacColor
  }
})
const tagBacStyle = computed(() => {
  return {
     background: props.tagColor
  }
})
</script>